package com.wxtt.android.item;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.fast.dev.frame.Adapter.recycleview.items.BaseItem;
import com.fast.dev.frame.ui.V;
import com.wxtt.android.R;
import com.wxtt.android.bean.MessageBean;

/**
 * 说明：消息Item
 * <p/>
 * 作者：fanly
 * <p/>
 * 时间：2016/1/25 15:51
 * <p/>
 * 版本：verson 1.0
 */
public class MessageItem extends BaseItem<MessageItem,MessageItem.ViewHolder,MessageBean> {

    @Override
    public int getType() {
        return R.id.item_message_id;
    }

    @Override
    public ViewHolder createViewHolder(View v) {
        return new ViewHolder(v);
    }

    @Override
    public void convert(ViewHolder holder, MessageBean item) {
        V.setText(holder.tv_message_title,item.getTitle());
        V.setText(holder.tv_message_time,item.getTime());
        V.setText(holder.tv_message_content,item.getContent());
    }


    @Override
    public int getLayoutRes() {
        return R.layout.item_message;
    }

    protected static class ViewHolder extends RecyclerView.ViewHolder{
        public TextView tv_message_title;
        public TextView tv_message_time;
        public TextView tv_message_content;
        public ViewHolder(View view){
            super(view);
            tv_message_title = (TextView) view.findViewById(R.id.tv_message_title);
            tv_message_time = (TextView) view.findViewById(R.id.tv_message_time);
            tv_message_content = (TextView) view.findViewById(R.id.tv_message_content);
        }
    }

}
